package com.xframe.domain.emnus;


import com.xframe.xdal.core.util.StringUtil;

public enum XWhether {
    YES,
    NO,
    NONE;

    public static XWhether convertTo(Object val){
        if(val == null){
            return XWhether.NONE;
        }
        try{
            return Enum.valueOf(XWhether.class,val.toString().toUpperCase());
        }catch (Exception e){
            return XWhether.NONE;
        }
    }


    public static boolean IsYesFlag(String flag){
        if(StringUtil.isEmpty(flag)){
            return false;
        }
        return "Y".equals(flag) || "YES".equals(flag);
    }

    public Object toVal(){
        return this.toString().toUpperCase();
    }



}
